package com.fourhats.dao.impl;

public class UserDAOImpl{
	
}
//import java.util.ArrayList;
//import java.util.List;
//
//import org.hibernate.Query;
//import org.hibernate.Session;
//import org.hibernate.SessionFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//
//import com.fourhats.dao.UserDAO;
//import com.fourhats.model.User;
//
//public class UserDAOImpl implements UserDAO, UserDetailsService {
//
//	@Autowired
//	private SessionFactory sessionFactory;
//	
//	private Session getCurrentSession(){
//		return sessionFactory.getCurrentSession();
//	}
//	
//	@SuppressWarnings("unchecked")
//	@Override
//	public User getUser(String username) {
//		List<User> userList = new ArrayList<User>();
//		Query query = getCurrentSession().createQuery("from User where username = :username");
//		query.setParameter("username", username);
//		userList = query.list();
//		if(userList.size() > 0){
//			return userList.get(0);
//		}
//		return null;
//	}
//
//	@SuppressWarnings("unchecked")
//	@Override
//	public UserDetails loadUserByUsername(String username)
//			throws UsernameNotFoundException {
//		List<User> userList = new ArrayList<User>();
//		Query query = getCurrentSession().createQuery("from User where username = :username");
//		query.setParameter("username", username);
//		userList = query.list();
//		if(userList.size() > 0){
//			return userList.get(0);
//		}
//		return null;
//	}
//
//}
